The present invention relates generally to a cache memory for a computer processor, and more specifically, to thread-based cache content saving for task switching.
In a computer system, in order to implement parallel execution of various software applications, the operating system (OS) may allot fixed units of time for execution of each partition, referred to as the partition's time quantum. A partition is allowed to run uninterrupted for its given time quantum before the OS switches to another thread, unless an event occurs that prevents the thread from completing its time quantum (e.g., the thread needs to wait on an input/output (I/O) operation). When a partition resumes execution in a subsequent time quantum, entries belonging to that thread may no longer be available in the cache, incurring a time penalty. This penalty may be particularly pronounced after a virtual machine swap from a first partition of the computing system to a second partition. The addresses of cache lines belonging to a partition that is not currently executing (i.e., a victim partition) may be recorded at the time that they are evicted from the cache for prefetching when the victim partition is rescheduled.